<?php

/**
 * O2O团购PC版本
 * ============================================================================
 * * 版权所有 2009-2016 郑州司科计算机科技有限公司，并保留所有权利。
 * 购买网址: http://www.jzphp.com；
 * ----------------------------------------------------------------------------
 * 这不是一个自由软件！您只能在不用于商业目的的前提下对程序代码进行修改和
 * 使用；不允许对程序代码以任何形式任何目的的再发布。
  * 咨询电话：400-823-0371 QQ：313999875
 * ============================================================================
 * $Author: zzsike $
 * $Time 2016-02-03 sammy $
*/


require_once(dirname(dirname(__FILE__)) . '/appwap.php');

need_login();
$now = time();
$detail = array();

$condition = array();
if (!option_yes('usercredit') || !option_yes('creditshop')) {
    Session::Set('notice', "未开启积分模块！");
	redirect(WEB_ROOT . '/order/index.php');
  }
$count = Table::Count('goods', $condition);
list($pagesize, $offset, $pagestring) = pagestring($count, 16);
$goods = DB::LimitQuery('goods', array(
	 		'condition'=>$condition,
			'size' => $pagesize,
			'offset' => $offset,
			'order' => 'ORDER BY id DESC',
			));
//积分商城头部		
$banner_jifeishangcheng = array(
				'display'=>'Y',
				"begin_time <= ".$now,
				"end_time > ".$now,
				'position' => 'jifeishangcheng',
			);
$banner_creditshop = DB::LimitQuery('banner', array(
				'condition' => $banner_jifeishangcheng,
				'order' => 'ORDER BY sort_order DESC, id DESC',
			));		
 /*积分分类查询*/
$category = DB::LimitQuery('category',array(
	'condition'=>array(
		'zone'=>'credit',
		'is_hot' =>'Y',
		'display'=>'Y',
	),
	'order' => 'ORDER BY sort_order DESC, id DESC',
	'size' => 7,				
));

$pagetitle = '积分商城';
include template('m_creditshop');
?>